//
//  ZBLinkmanItemViewModel.m
//  BaseRACDemo
//
//  Created by Angel_Yan on 2018/3/27.
//  Copyright © 2018年 庄波. All rights reserved.
//

#import "ZBLinkmanItemViewModel.h"

@interface ZBLinkmanItemViewModel ()

///< 数据
@property (nonatomic, readwrite, strong) ZBLinkmanItem *linkmanItem;

/// cellHeight
@property (nonatomic, readwrite, assign) CGFloat cellHeight;


///< 姓名+手机号
@property (nonatomic,readwrite ,copy) NSString *strLabLinkman;

///< 头像隐藏
@property (nonatomic,readwrite,assign) BOOL imgVHide;
///< 头像
@property (nonatomic,readwrite ,copy) UIImage *imgPortrait;

///< 名隐藏
@property (nonatomic,readwrite,assign) BOOL labNameHide;
///< 单个名字
@property (nonatomic,readwrite ,copy) NSString *strLabName;

@end

@implementation ZBLinkmanItemViewModel

- (instancetype)initWithLinkmanItem:(ZBLinkmanItem *)linkmanItem {
    self = [super init];
    if (self) {
        
        self.linkmanItem = linkmanItem;
        self.cellHeight = 70;

        self.strLabLinkman = [NSString stringWithFormat:@"%@(%@)",self.linkmanItem.strNickName,self.linkmanItem.strPhone];
        
        self.imgPortrait = [[UIImage alloc] initWithData:self.linkmanItem.dataPortrait];
        self.imgVHide = self.imgPortrait == nil ? YES : NO;
        
        
        self.strLabName = self.linkmanItem.strNickName.length > 0 ? [self.linkmanItem.strNickName substringToIndex:1] : @"无";
        self.labNameHide = !self.imgVHide;
        
        self.isSelect = NO;
    }
    return self;
}



@end
